<?php
/**
 * Created by PhpStorm.
 * User: sunshine
 * Date: 2016/8/30
 * Time: 21:27
 */
require 'Admin/Model/Model.php';
class TypeModel extends Model{
    function __Construct(){
        parent::__Construct();
    }
    function getTypeList(){
        $sql = "select * from type";
        $data = $this->conn->query($sql);
        return $data;
    }
    function addType($data){

        $type = array(
            'typename' => trim($data['typename'])
        );
        $keys = implode(',',array_keys($type));
        $values = implode("','", array_values($type));
        $sql="insert into type ({$keys}) VALUES ('{$values}')";
        //执行SQL语句
        $d = $this->conn->query($sql);
        return $d;
    }

}

?>